#ifndef __IDLETHREAD_H__
#define __IDLETHREAD_H__

#include "AtomicPriorityQueue.h"
#include "Task.h"
#include "ThreadPoolObject.h"

HTHREADPOOL_NAMESPACE_BEGIN
    // 该类可以实现线程退出后可继续执行
    class IdleThread final : public ThreadPoolObject
    {
    public:
        IdleThread(AtomicQueue<Task>* poolTaskQueue, AtomicPriorityQueue<Task>* poolPriorityTaskQueue);
        ~IdleThread();

    protected:
        virtual void run() override;
        virtual void excuteTask() override;
        virtual void excuteTasks() override;
        virtual void exit() override;   // 退出线程执行

    private:
        AtomicPriorityQueue<Task>* m_pool_task_priority_queue;  // 线程池中优先级任务
    };

HTHREADPOOL_NAMESPACE_END

#endif
